/*
 * Copyright (c) 2017 22420103@QQ.COM 版权所有
 */
package com.lehe.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.lehe.entry.MyAgentDto;
import com.lehe.entry.PlayerInfoDto;
import com.lehe.entry.UserPayDetailDto;

/**
 * 用户管理接口
 *
 * @author lwh
 * 
 * @since 2017-02-26
 */
@Mapper
public interface UserManagerDao {

    /**
     * 查询用户的玩家
     * @param queryStr 玩家的id或昵称
     * @param userId 查询用户的父代理userid in userId的玩家
     * @return
     */
    public List<PlayerInfoDto> queryUserPlayer(@Param("queryStr")String queryStr,@Param("sd")String sd,@Param("ed")String ed,
    		@Param("userId")List<Long> userId,@Param("page")Integer page,@Param("pageSize")Integer pageSize);
    public List<PlayerInfoDto> queryUserPlayerById(@Param("userId")Long userId);
    
    public Integer queryUserPlayerCount(@Param("queryStr") String queryStr,@Param("sd")String sd,@Param("ed")String ed,@Param("userId")List<Long> userId);
    
    public List<MyAgentDto> queryUserAgent(@Param("queryStr")String queryStr,@Param("agentId")Long agentId,
    		@Param("sd")String sd,@Param("ed")String ed,@Param("level")String level,
    		@Param("page")Integer page,@Param("pageSize")Integer pageSize);
    
    public Integer queryUserAgentCount(@Param("queryStr") String queryStr,@Param("agentId")Long agentId,
    		@Param("sd")String sd,@Param("ed")String ed,@Param("level")String level);

	public void chargeJB(@Param("userId")Long userId, @Param("count")Long count);

	public List<MyAgentDto> queryUserAgentByIds(@Param("queryStr")String queryStr,
			@Param("sd")String sd,
			@Param("ed")String ed, 
			@Param("ids")List<Long> ids, 
			@Param("level")String level, 
			@Param("page")Integer pageIndex, 
			@Param("pageSize")Integer pageSize
			);
	public Integer queryUserAgentByIdsCount(@Param("queryStr")String queryStr,@Param("sd")String sd,@Param("ed")String ed,
			@Param("ids")List<Long> ids,@Param("level")String level);

	public Integer queryOnlineCount();

	/**
	 * 根据agentIds，agentId自己、下属玩家、下属代理、子孙玩家、子孙代理的充值总额。只支持三级代理
	 * @param agentId
	 * @return
	 */
	public String queryTotalFeeCountByAgentIds(@Param("ids")List<Long> ids,@Param("agentIds")List<Long> agentIds);

	public String queryTotalFeeCountByAgentIdsToday(@Param("ids")List<Long> ids,@Param("agentIds")List<Long> agentIds);

	public Integer queryTotalCountByAgentIdsToday(@Param("ids")List<Long> ids,@Param("agentIds")List<Long> agentIds);

	/**
	 * 查询系统中所有代理总数
	 * @return
	 */
	public Integer queryAllAgentCount();

	public List<UserPayDetailDto> queryNewestCharge(@Param("ids")List<Long> ids,@Param("agentIds")List<Long> agentIds);

	/**查询指定user ids本人充值*/
	public String queryOwnChargeSumByIds(@Param("userIds")List<Long> ids,@Param("sd")String sd,@Param("ed")String ed);
	public String queryOwnChargeSumByIdsCount(@Param("userIds")List<Long> ids,@Param("sd")String sd,@Param("ed")String ed);
	/**查询指定user ids下属玩家充值*/
	public String queryPlayerChargeSumByIds(@Param("userIds")List<Long> ids,@Param("sd")String sd,@Param("ed")String ed);
	/**查询指定user ids下属代理，以及下属代理的玩家，以及下属代理的子孙代理及其玩家的充值*/
	public String queryAgentChargeSumByIds(@Param("userIds")List<Long> ids,@Param("sd")String sd,@Param("ed")String ed);
}
